-- @owner: zou_jialiang050
-- @date: 2024/4/2
-- @testpoint: pip row返回类型错误，部分测试点合理报错

--step1:创建嵌套表类型;expect:成功
create or replace type typ_pipelined_0011 as(c1 integer, c2 float(10), c3 text, c4 date, c5 time);
create or replace type tb_type_0011 as table of typ_pipelined_0011;

--step2:pip row测试;expect:失败
create or replace function func_pipelined_0011(count in number)
returns tb_type_0011 pipelined
as $$
declare
result typ_pipelined_0011;
begin
for i in 1 .. count loop
    pipe row(i);
    PIPE ROW('result' || TO_CHAR(i));
end loop;
return;
end;
$$ language plpgsql;
/

--step3:清理环境;expect:成功
drop function if exists func_pipelined_0011;
drop type if exists tb_type_0011 cascade;
drop type if exists type_0011 cascade;
